home *** CD-ROM | disk | FTP | other *** search
/ Champak 142 / Volume 142 Oct 17 2011 - Damaged.iso / Games / parasite-x.swf / scripts / frame_8 / DoAction.as < prev   
Text File  |  2011-10-17  |  1KB  |  73 lines

  1. Test.onEnterFrame = function()
  2. {
  3.    if(_root.gamepaused == 0)
  4.    {
  5.       var _loc4_ = _root._xmouse;
  6.       var _loc3_ = _root._ymouse;
  7.       if(Math.abs(_loc4_ - this._x) < 1)
  8.       {
  9.          this._x = _loc4_;
  10.       }
  11.       else
  12.       {
  13.          this._x -= (this._x - _loc4_) / 12 - _root.handeling;
  14.       }
  15.       if(Math.abs(_loc3_ - this._y) < 1)
  16.       {
  17.          this._y = _loc3_;
  18.       }
  19.       else
  20.       {
  21.          this._y -= (this._y - _loc3_) / 12 - _root.handeling;
  22.       }
  23.    }
  24. };
  25. this.createEmptyMovieClip("draw",1);
  26. length = 15;
  27. speed = 1.5;
  28. wind = 0;
  29. gravity = 0;
  30. i = 0;
  31. while(i < length)
  32. {
  33.    _root.createEmptyMovieClip("line" + i,i + 20);
  34.    i++;
  35. }
  36. this.onEnterFrame = function()
  37. {
  38.    draw.clear();
  39.    i = 0;
  40.    while(i < length)
  41.    {
  42.       me = this["line" + i];
  43.       if(i == 0)
  44.       {
  45.          tx = _root.Test._x;
  46.          ty = _root.Test._y;
  47.       }
  48.       else
  49.       {
  50.          tx = this["line" + (i - 1)]._x;
  51.          ty = this["line" + (i - 1)]._y;
  52.       }
  53.       xdiff = (tx - me._x) / speed;
  54.       ydiff = (ty - me._y) / speed;
  55.       if(Math.abs(xdiff) > 1)
  56.       {
  57.          me._x += xdiff;
  58.       }
  59.       if(Math.abs(ydiff) > 1)
  60.       {
  61.          me._y += ydiff;
  62.       }
  63.       me._x += wind;
  64.       me._y += gravity;
  65.       draw.lineStyle(length - i,16777215,100);
  66.       draw.moveTo(me._x,me._y);
  67.       draw.lineTo(tx,ty);
  68.       me.swapDepths(1);
  69.       _root.Test.swapDepths(999);
  70.       i++;
  71.    }
  72. };
  73.